import 'package:get/get.dart';

import '../data/repositories/auth_repository.dart';
import '../data/repositories/user_repository.dart';
import '../data/repositories/device_repository.dart';
import '../data/providers/auth_provider.dart';
import '../data/providers/user_provider.dart';
import '../data/providers/device_provider.dart';
import '../domain/services/auth_business.dart';
import '../domain/services/user_business.dart';
import '../domain/services/device_business.dart';

/// 仓库绑定类
/// 负责注册数据层和领域层依赖
class RepositoryBinding implements Bindings {
  @override
  void dependencies() {
    // 数据提供者
    if (!Get.isRegistered<AuthProvider>()) {
      Get.put(AuthProvider(), permanent: true);
    }
    
    if (!Get.isRegistered<UserProvider>()) {
      Get.put(UserProvider(), permanent: true);
    }
    
    if (!Get.isRegistered<DeviceProvider>()) {
      Get.put(DeviceProvider(), permanent: true);
    }
    
    // 数据仓库
    if (!Get.isRegistered<AuthRepository>()) {
      Get.put(AuthRepository(), permanent: true);
    }
    
    if (!Get.isRegistered<UserRepository>()) {
      Get.put(UserRepository(), permanent: true);
    }
    
    if (!Get.isRegistered<DeviceRepository>()) {
      Get.put(DeviceRepository(), permanent: true);
    }
    
    // 业务服务
    if (!Get.isRegistered<AuthBusiness>()) {
      Get.put(AuthBusiness(), permanent: true);
    }
    
    if (!Get.isRegistered<UserBusiness>()) {
      Get.put(UserBusiness(), permanent: true);
    }
    
    if (!Get.isRegistered<DeviceBusiness>()) {
      Get.put(DeviceBusiness(), permanent: true);
    }
  }
} 